<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
/* 设置定位之后，相对定位和绝对定位他是相对于具有定位的父级元素进行位置调整，如果父级元素不存在
   定位，则继续向上逐级寻找，直到顶层文档 */
        .container{
            width: 200px;
            height: 200px;
            background-color: rgb(18, 104, 161);
            /* position: relative; */
            margin-left: 100px;
            
        }

        .box{
            width: 100px;
            height: 100px;
            background-color: blueviolet;
            position: absolute;
            left: 50px;
            top: 50px;
        }

    </style>
</head>
<body>

    <div class="container">
        <div class="box"></div>
    </div>
    
</body>
</html>